package cn.edu.wynu.oop.polymorphic;

public class TestIncome {
    public static void main(String[] args) {
        Income income = new Income(10000);
        System.out.println("tax = " + income.getTax());

        Income salary = new Salary(6000);
        System.out.println("salary tax = " + salary.getTax());

        Income[] incomes = {new Income(10000), new Salary(6000)};
        double sum = 0;
        for (Income inc: incomes) {
            double tax = inc.getTax();
            sum += tax;
        }
        System.out.println("total tax:" + sum);
    }
}
